#include "INode.h"

INode::INode()
{
	m_parent = 0;
}

INode::~INode()
{
	m_children.clear();
}

void INode::Enable()
{
	for( Vector_t::iterator it = m_children.begin(); it != m_children.end(); ++it )
		(*it)->Enable();
}

void INode::Push_Back( Pointer<INode>& node )
{
	m_children.push_back( node );
	node->m_parent = this;
}

void INode::Pop_Back( INode* node )
{
	for( Vector_t::iterator it = m_children.begin(); it != m_children.end(); ++it )
		if( it->getPointer() ==  node )
		{
			m_children.erase( it );
			break;
		}
}

void INode::Remove()
{
	if (m_parent)
	{
		m_parent->Pop_Back(this);
		m_parent = 0;
	}
}
INode::Vector_t& INode::getChildren()
{
	return m_children;
}